home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / src.zoo / src / erase_win.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-17  |  1.7 KB  |  65 lines

  1. /*                        Copyright (c) 1987 Bellcore
  2.  *                            All Rights Reserved
  3.  *       Permission is granted to copy or use this program, EXCEPT that it
  4.  *       may not be sold for profit, the copyright notice must be reproduced
  5.  *       on copies, and credit should be given to Bellcore where it is due.
  6.  *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7.  */
  8. /*    $Header: erase_win.c,v 1.1 89/03/17 08:21:06 sau Exp $
  9.     $Source: /m1/mgr.new/src/RCS/erase_win.c,v $
  10. */
  11. static char    RCSid_[] = "$Source: /m1/mgr.new/src/RCS/erase_win.c,v $$Revision: 1.1 $";
  12. /* erase a pixrect to background pattern */
  13.  
  14. #include "bitmap.h"
  15. #include "defs.h"
  16. #include <stdio.h>        /* temp */
  17.  
  18. erase_win(map)
  19. BITMAP *map;            /* bit map to erase */
  20.    {
  21.    Bit_pattern(map,0,0,BIT_WIDE(map),BIT_HIGH(map),
  22.               BIT_SRC|GETCOLOR(12),&pattern);
  23.    }
  24.  
  25. /* fill DST bitmap with SRC, preserving alignment */
  26.  
  27. Bit_pattern(dst,dx,dy,wide,high,func,src,d1,d2)
  28. register BITMAP *dst,*src;
  29. register int dx,dy;
  30. int wide,high;
  31. int func;
  32. int d1,d2;        /* unused */
  33.    {
  34.    register int incr;
  35.    register int sw = BIT_WIDE(src);
  36.    register int sh = BIT_HIGH(src);
  37.    int x = BIT_X(dst) + dx;
  38.    int y = BIT_Y(dst) + dy;
  39.    int xdel = x % sw;
  40.    int ydel = y % sh;
  41.    int de;
  42.  
  43.    dx -= xdel, wide += xdel;
  44.    de=dx+wide;
  45.  
  46.    /* get partial strip */
  47.  
  48.    if (ydel) {
  49.       for(incr=dx;incr<de;incr+=sw)
  50.          bit_blit(dst,incr,dy-ydel,sw,sh,func,src,0,0);
  51.       dy += sh-ydel;
  52.       }
  53.  
  54.    /* get 1st strip */
  55.  
  56.    for(incr=dx;incr<de;incr+=sw)
  57.       bit_blit(dst,incr,dy,sw,sh,func,src,0,0);
  58.  
  59.    /* get the rest */
  60.  
  61.    de = dy+high;
  62.    for(incr=dy+sh;incr<de;incr+=sh,sh<<1)
  63.       bit_blit(dst,dx,incr,wide,sh,func,dst,dx,dy);
  64.    }
  65.